import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
    state:{//存放状态
        // 是否触底加载
        pageType: '',
        bottomFunc: {
            'index': null,
            'kind': null,
            'history': null,
            'my': null
        },
        // 
        age: 22,
        personInfo: { // 用户信息
            src: 'https://zhanlehr.com:8001/plantknow/public/images/44.jpg',
            userName: '游客',
            phone: '',
            token: ''
        },
        loginStatus: false, // 登录状态
        loading: false, // 页面加载状态
        bottomLoading: false, // 触底加载 
        // dnsName: 'http://119.23.245.89/',
        dnsName: 'http://127.0.0.1:3003/',
        projectName: 'plantknow'
    },
    getters: {
        // loading(state) {
        //     return state.loading
        // }
    },
    mutations: {
        updateParams(state, arr) {
            // 变更状态
            if ((typeof arr[1]) === 'object') {
                for(var key in arr[1]) {
                    state[arr[0]][key] = arr[1][key]
                }
            } else {
                state[arr[0]] = arr[1];
            }
        }
    }
})
// console.log(store)
export default store
// http://dysmsapi.aliyuncs.com/?Signature=NAxwl1W9ROkidJfGeZrsKUXw%2BQ4%3D
// &AccessKeyId=LTAI5tALmG4eVQRtkjKKiKnK
// &Action=SendSms
// &RegionId=cn-hangzhou
// &SignatureMethod=HMAC-SHA1
// &SignatureNonce=313ef0fb-0393-464f-a6e2-59d9ca2585b1
// &SignatureVersion=1.0
// &Timestamp=2019-01-08T08%3A18%3A18Z
// &Version=2017-05-25